package com.scnb.Strategy;

import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        int[] a = {9, 2, 5, 3, 7, 1, 4};
        Cat[] cats = {new Cat(3, 3), new Cat(1, 1), new Cat(5,5)};
        Sorter<Cat> sorter = new Sorter();
        sorter.sort(cats, new CatWeightComparator());
//        sorter.sort(cats, new CatHeightComparator());
        //lambda 表达式方式
//        sorter.sort(cats, (Cat o1, Cat o2)->{
//            if (o1.weight < o2.weight){
//                return -1;
//            }else if (o1.weight > o2.weight){
//                return 1;
//            }else{
//                return 0;
//            }
//        });
        System.out.println(Arrays.toString(cats));
    }
}
